﻿using System;

using System.Collections.Generic;
using System.Text;
using RaisingStudio.Data.Common;

namespace SmartDeviceProject2
{
    public class TestAssert
    {
        private LogWrapperWrite _writeDelegate;
        public LogWrapperWrite WriteDelegate
        {
            get { return _writeDelegate; }
            set { _writeDelegate = value; }
        }

        public TestAssert()
        {
        }

        public TestAssert(LogWrapperWrite logWrapperWrite)
        {
            this._writeDelegate = logWrapperWrite;
        }


        public void IsNotNull(object value)
        {
            string message = string.Format("{0} is not null, {1}", value, value != null);
            this.WriteDelegate(message);
            if (value != null)
            {
            }
            else
            {
                throw new ArgumentException(message, "value");
            }
        }

        public void IsTrue(bool value)
        {
            string message = string.Format("{0} is true, {1}", value, value == true);
            this.WriteDelegate(message);
            if (value == true)
            {
            }
            else
            {
                throw new ArgumentException(message, "value");
            }
        }

        public void AreEqual(object v1, object v2)
        {
            string message = string.Format("{0} are equal {1}, {2}", v1, v2, v1 == v2);
            this.WriteDelegate(message);
            if ((v1 == v2) || ((v1 is IComparable) && (((IComparable)v1).CompareTo(v2) == 0)))
            {
            }
            else
            {
                throw new ArgumentException(message, "value");
            }
        }

        public void GreaterOrEqual(object v1, object v2)
        {
            string message = string.Format("{0} greater or equal {1}, {2}", v1, v2, v1 == v2);
            this.WriteDelegate(message);
            //if (v1 == v2)
            //{
            //}
            //else
            //{
            //    throw new ArgumentException(message, "value");
            //}
        }

        public void Greater(object v1, object v2)
        {
            string message = string.Format("{0} greater {1}, {2}", v1, v2, v1 == v2);
            this.WriteDelegate(message);
            //if (v1 == v2)
            //{
            //}
            //else
            //{
            //    throw new ArgumentException(message, "value");
            //}
        }

        public void LessOrEqual(object v1, object v2)
        {
            string message = string.Format("{0} less or equal {1}, {2}", v1, v2, v1 == v2);
            this.WriteDelegate(message);
            //if (v1 == v2)
            //{
            //}
            //else
            //{
            //    throw new ArgumentException(message, "value");
            //}
        }
    }
}
